xenpaging: Add checks for p2m_is_valid() after calls to gfn_to_mfn()
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 21 Dec 2009 10:40:51 +0000 (10:40 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 21 Dec 2009 10:40:51 +0000 (10:40 +0000)
that replace calls to gmfn_to_mfn(), which does the check internally.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
xen/arch/x86/mm.c
xen/common/grant_table.c

index 107454118f2eb953f94352a88a3a28ef4ba4dd44..9eec698ae49a99df2d84ca50d1558b27f45ecd61 100644 (file)
@@ -3105,6 +3105,8 @@ int do_mmu_update(
             req.ptr -= cmd;
             gmfn = req.ptr >> PAGE_SHIFT;
             mfn = mfn_x(gfn_to_mfn(pt_owner, gmfn, &p2mt));
+            if ( !p2m_is_valid(p2mt) )
+              mfn = INVALID_MFN;
 
             if ( p2m_is_paged(p2mt) )
             {
index 9992017864e4abbbd6172b32bde15eb020e10521..4c6bd633213ee07703362602afe429cd64863fd9 100644 (file)
@@ -1888,6 +1888,8 @@ __gnttab_copy(
     {
         p2m_type_t p2mt;
         s_frame = mfn_x(gfn_to_mfn(sd, op->source.u.gmfn, &p2mt));
+        if ( !p2m_is_valid(p2mt) )
+          s_frame = INVALID_MFN;
         if ( p2m_is_paging(p2mt) )
         {
             p2m_mem_paging_populate(sd, op->source.u.gmfn);
@@ -1929,6 +1931,8 @@ __gnttab_copy(
     {
         p2m_type_t p2mt;
         d_frame = gfn_to_mfn_private(dd, op->dest.u.gmfn, &p2mt);
+        if ( !p2m_is_valid(p2mt) )
+          d_frame = INVALID_MFN;
         if ( p2m_is_paging(p2mt) )
         {
             p2m_mem_paging_populate(dd, op->dest.u.gmfn);